<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title>IDValidator</title>
    <script type="text/javascript" src="../../src/IDValidator.js"></script>
    <script type="text/javascript" src="../../src/GB2260.js"></script>
    <script type="text/javascript">
window.onload = function(){
    function log() {
        for(var i=0;i<arguments.length;i++){
            var m = arguments[i];
            if( typeof m == 'object' ){
                for( var k in m ){
                    if( m.hasOwnProperty(k) ){
                        log(k+':',m[k]);
                    }
                }
            }else{
                var p = document.createElement('p');
                p.innerText = m.toString();
                document.body.appendChild(p);
            }
        }
    }
   
    	
    var testId = "371001198010082394";
    var fakeId = "345955198706122245";
    var fifteenId = "431389760616601";

    var Validator = new IDValidator();

    //检测是否合法
    log( '\nID:'+testId+'的合法性为:\n', Validator.isValid( testId ) );
    log( '\n假ID:'+fakeId+'的合法性为:\n', Validator.isValid( fakeId ) );
    //15位
    log( '\n15位ID:'+fifteenId+'的合法性为:\n', Validator.isValid( fifteenId ) );

    //输出分析信息
    log( '\nID:'+testId+'的信息为:\n', Validator.getInfo( testId) );
    log( '\n15位ID:'+fifteenId+'的信息为:\n', Validator.getInfo( fifteenId ) );


    //带GB2260
    var Validator2 = new IDValidator(GB2260);

    log( '\nID:'+testId+'的信息为(带地址):\n', Validator2.getInfo( testId ) );

    //伪造ID
    var makeID = Validator2.makeID();

    log( '\n制作的ID:'+makeID+'的信息为:\n',Validator2.getInfo( makeID ) );

    //伪造一个15位ID
    var makeID2 = Validator2.makeID(false);
    log( '\n制作的15位ID:'+makeID2+'的信息为:\n',Validator2.getInfo( makeID2 ) );
};
    </script>
</head>
<body>
	
</body>
</html>
